﻿using Elsa.Http;
using Elsa.Workflows.Activities;
using Elsa.Workflows.Contracts;

namespace ElsaService
{
    public class CustomerWorkflow : IWorkflow //也可以继承WorkflowBase
    {
        public async ValueTask BuildAsync(IWorkflowBuilder builder, CancellationToken cancellationToken = default)
        {
            //配置起始端点
            builder.Root = new Sequence()
            {
                Activities =
                {
                    new HttpEndpoint()
                    {
                        Path=new("/hello-world"),
                        CanStartWorkflow = true,
                    },
                    new WriteHttpResponse()
                    {
                        Content=new("hellw world or http workflows")
                    }
                }
            };
            await Task.CompletedTask;
        }
    }
}